package cn.itcast.firstmyapp.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 */
public class TestServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * doGet方法，用来接受浏览器发送的get请求
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 获取与浏览其绑定的输出流
	    PrintWriter out = response.getWriter();
	    out.print("this servlet is created by eclipse!!!");
	    
	}

	/**
	 * doGet方法，用来接受浏览器发送的get请求
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调用doGet方法
	    this.doGet(request, response);
	}
	/**
     * 一般情况下，为了简化开发，会在doPost方法里调用doGet方法
     */
}
